#include<bits/stdc++.h>
const long double eps=1e-6;
using namespace std;
namespace IO{
    char buff[1<<21],*p1=buff,*p2=buff;
    char getch(){
        return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;
    }
    template<typename T>
    void read(T &x){
        char ch=getch();int fl=1;x=0;
        while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}
        while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}
        x*=fl;
    }
    template<typename T,typename ...Args>
    void read(T &x,Args& ...args){
        read(x);read(args...);
    }
    char obuf[1<<21],*p3=obuf;
    void putch(char ch){
        if(p3-obuf<(1<<21))*p3++=ch;
        else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;
    }
    char ch[100];
    template<typename T>
    void write(T x){
        if(!x)return putch('0');
        if(x<0)putch('-'),x*=-1;
        int top=0;
        while(x)ch[++top]=x%10+48,x/=10;
        while(top)putch(ch[top]),top--;
    }
    template<typename T,typename ...Args>
    void write(T x,Args ...args){
        write(x),putch(' '),write(args...);
    }
    void flush(){fwrite(obuf,p3-obuf,1,stdout);}
}
using namespace IO;
const int N=1e6+5;
int n;
long double ans;
struct node{
	long double r,R,h;
}a[N];
long double calc1(node A,long double R){return (R-A.r)*A.h/(A.R-A.r);}
long double calc(node A,node B){return max(min(max(calc1(A,B.r),B.R>A.R?A.h-calc1(B,A.R):calc1(A,B.R)-B.h),A.h),0.l);}
long double sum[N];
int tot;
node st[N];
signed main(){
	freopen("wan.in","r",stdin);
	freopen("wan.out","w",stdout);
	read(n);
	for(int i=1;i<=n;i++)read(a[i].h,a[i].r,a[i].R);
	for(int i=1;i<=n;i++){
		long double tmp=0;
		while(tot){
			tmp=max(tmp,calc(st[tot],a[i])+sum[tot]);
			if(tmp+a[i].h<sum[tot]+st[tot].h)break;
			tot--;
		}
		ans=max(ans,tmp+a[i].h);
		sum[++tot]=tmp;
		st[tot]=a[i];
	}
	printf("%.12Lf",ans);
	return 0;
}/*
3
50 30 80
35 25 70
40 10 90
*/

